/**
 * <copyright>
 * </copyright>
 *
 * $Id$
 */
package EA_Model.IEC61970.Meas.impl;

import EA_Model.IEC61970.Meas.Analog;
import EA_Model.IEC61970.Meas.MeasPackage;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Analog</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.AnalogImpl#getMaxValue <em>Max Value</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.AnalogImpl#getMinValue <em>Min Value</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.AnalogImpl#getNormalValue <em>Normal Value</em>}</li>
 *   <li>{@link EA_Model.IEC61970.Meas.impl.AnalogImpl#getPositiveFlowIn <em>Positive Flow In</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class AnalogImpl extends MeasurementImpl implements Analog {
	/**
	 * The cached value of the '{@link #getMaxValue() <em>Max Value</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMaxValue()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float maxValue;

	/**
	 * The cached value of the '{@link #getMinValue() <em>Min Value</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getMinValue()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float minValue;

	/**
	 * The cached value of the '{@link #getNormalValue() <em>Normal Value</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getNormalValue()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Float normalValue;

	/**
	 * The cached value of the '{@link #getPositiveFlowIn() <em>Positive Flow In</em>}' reference.
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @see #getPositiveFlowIn()
	 * @generated
	 * @ordered
	 */
	protected EA_Model.IEC61970.Domain.Boolean positiveFlowIn;

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	protected AnalogImpl() {
		super();
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	protected EClass eStaticClass() {
		return MeasPackage.Literals.ANALOG;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getMaxValue() {
		if (maxValue != null && maxValue.eIsProxy()) {
			InternalEObject oldMaxValue = (InternalEObject)maxValue;
			maxValue = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldMaxValue);
			if (maxValue != oldMaxValue) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MeasPackage.ANALOG__MAX_VALUE, oldMaxValue, maxValue));
			}
		}
		return maxValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetMaxValue() {
		return maxValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMaxValue(EA_Model.IEC61970.Domain.Float newMaxValue) {
		EA_Model.IEC61970.Domain.Float oldMaxValue = maxValue;
		maxValue = newMaxValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.ANALOG__MAX_VALUE, oldMaxValue, maxValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getMinValue() {
		if (minValue != null && minValue.eIsProxy()) {
			InternalEObject oldMinValue = (InternalEObject)minValue;
			minValue = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldMinValue);
			if (minValue != oldMinValue) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MeasPackage.ANALOG__MIN_VALUE, oldMinValue, minValue));
			}
		}
		return minValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetMinValue() {
		return minValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setMinValue(EA_Model.IEC61970.Domain.Float newMinValue) {
		EA_Model.IEC61970.Domain.Float oldMinValue = minValue;
		minValue = newMinValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.ANALOG__MIN_VALUE, oldMinValue, minValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float getNormalValue() {
		if (normalValue != null && normalValue.eIsProxy()) {
			InternalEObject oldNormalValue = (InternalEObject)normalValue;
			normalValue = (EA_Model.IEC61970.Domain.Float)eResolveProxy(oldNormalValue);
			if (normalValue != oldNormalValue) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MeasPackage.ANALOG__NORMAL_VALUE, oldNormalValue, normalValue));
			}
		}
		return normalValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Float basicGetNormalValue() {
		return normalValue;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setNormalValue(EA_Model.IEC61970.Domain.Float newNormalValue) {
		EA_Model.IEC61970.Domain.Float oldNormalValue = normalValue;
		normalValue = newNormalValue;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.ANALOG__NORMAL_VALUE, oldNormalValue, normalValue));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean getPositiveFlowIn() {
		if (positiveFlowIn != null && positiveFlowIn.eIsProxy()) {
			InternalEObject oldPositiveFlowIn = (InternalEObject)positiveFlowIn;
			positiveFlowIn = (EA_Model.IEC61970.Domain.Boolean)eResolveProxy(oldPositiveFlowIn);
			if (positiveFlowIn != oldPositiveFlowIn) {
				if (eNotificationRequired())
					eNotify(new ENotificationImpl(this, Notification.RESOLVE, MeasPackage.ANALOG__POSITIVE_FLOW_IN, oldPositiveFlowIn, positiveFlowIn));
			}
		}
		return positiveFlowIn;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public EA_Model.IEC61970.Domain.Boolean basicGetPositiveFlowIn() {
		return positiveFlowIn;
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	public void setPositiveFlowIn(EA_Model.IEC61970.Domain.Boolean newPositiveFlowIn) {
		EA_Model.IEC61970.Domain.Boolean oldPositiveFlowIn = positiveFlowIn;
		positiveFlowIn = newPositiveFlowIn;
		if (eNotificationRequired())
			eNotify(new ENotificationImpl(this, Notification.SET, MeasPackage.ANALOG__POSITIVE_FLOW_IN, oldPositiveFlowIn, positiveFlowIn));
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public Object eGet(int featureID, boolean resolve, boolean coreType) {
		switch (featureID) {
			case MeasPackage.ANALOG__MAX_VALUE:
				if (resolve) return getMaxValue();
				return basicGetMaxValue();
			case MeasPackage.ANALOG__MIN_VALUE:
				if (resolve) return getMinValue();
				return basicGetMinValue();
			case MeasPackage.ANALOG__NORMAL_VALUE:
				if (resolve) return getNormalValue();
				return basicGetNormalValue();
			case MeasPackage.ANALOG__POSITIVE_FLOW_IN:
				if (resolve) return getPositiveFlowIn();
				return basicGetPositiveFlowIn();
		}
		return super.eGet(featureID, resolve, coreType);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eSet(int featureID, Object newValue) {
		switch (featureID) {
			case MeasPackage.ANALOG__MAX_VALUE:
				setMaxValue((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case MeasPackage.ANALOG__MIN_VALUE:
				setMinValue((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case MeasPackage.ANALOG__NORMAL_VALUE:
				setNormalValue((EA_Model.IEC61970.Domain.Float)newValue);
				return;
			case MeasPackage.ANALOG__POSITIVE_FLOW_IN:
				setPositiveFlowIn((EA_Model.IEC61970.Domain.Boolean)newValue);
				return;
		}
		super.eSet(featureID, newValue);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public void eUnset(int featureID) {
		switch (featureID) {
			case MeasPackage.ANALOG__MAX_VALUE:
				setMaxValue((EA_Model.IEC61970.Domain.Float)null);
				return;
			case MeasPackage.ANALOG__MIN_VALUE:
				setMinValue((EA_Model.IEC61970.Domain.Float)null);
				return;
			case MeasPackage.ANALOG__NORMAL_VALUE:
				setNormalValue((EA_Model.IEC61970.Domain.Float)null);
				return;
			case MeasPackage.ANALOG__POSITIVE_FLOW_IN:
				setPositiveFlowIn((EA_Model.IEC61970.Domain.Boolean)null);
				return;
		}
		super.eUnset(featureID);
	}

	/**
	 * <!-- begin-user-doc -->
	 * <!-- end-user-doc -->
	 * @generated
	 */
	@Override
	public boolean eIsSet(int featureID) {
		switch (featureID) {
			case MeasPackage.ANALOG__MAX_VALUE:
				return maxValue != null;
			case MeasPackage.ANALOG__MIN_VALUE:
				return minValue != null;
			case MeasPackage.ANALOG__NORMAL_VALUE:
				return normalValue != null;
			case MeasPackage.ANALOG__POSITIVE_FLOW_IN:
				return positiveFlowIn != null;
		}
		return super.eIsSet(featureID);
	}

} //AnalogImpl
